package com.zjj.reggie.common;

/**
 * 基于ThreadLocal封装工具类，用户保存和获取当前用户id
 */
public class BaseContext {

    private static final ThreadLocal<Long> threadLocal = new ThreadLocal<>();// 保存用户id

    // 设置当前用户id
    public static void setCurrentId(Long id) {

        threadLocal.set(id);
    }


    // 获取当前用户id
    public static Long getCurrentId() {

        return threadLocal.get();
    }
}
